package com.beta.auth.constants;

/**
 * redis缓存key的配置
 *
 * @author zdwang
 */
public class CacheConstans {

    private CacheConstans(){}

    public static final String BASE_KEY = "user-auth-center:";

    /**
     * 各种应用的access_token的key配置
     */
    public static final String ACCESS_TOKEN_KEY = BASE_KEY + "access_token:enterpriseId:%s:secretKey:%s";

    public static final String CORP_GEOUP_ACCESS_TOKEN_KEY = BASE_KEY + "access_token:corpId:%s:agentId:%s";

    public static final String CORP_GEOUP_ACCESS_TOKEN_LOCK = BASE_KEY + "lock:access_token:corpId:%s:agentId:%s";


    /**
     * 各种应用的access_token的key配置 config
     */
    public static final String JSAPI_TICKET_KEY = BASE_KEY + "jsapi_ticket:enterpriseId:%s:";

    /**
     * 各种应用的access_token的key配置 agent
     */
    public static final String JSAPI_TICKET_AGENT_KEY = BASE_KEY + "jsapi_ticket:enterpriseId:%s:%s";

    /**
     * 保证只有一个线程去获取企业微信access_token，锁的时长是1秒
     */
    public static final Long ACCESS_TOKEN_LOCK_TIME = 3L * 1000;

    /**
     * 保证只有一个线程去获取企业微信js_ticket，锁的时长是1秒
     */
    public static final Long JSAPI_TICKET_LOCK_TIME = 3L * 1000;

    /**
     * saas认证 缓存用户信息
     */
    public static final String SAAS_AUTH_USER_INFO = "SaasAuth:UserInfo:%s";

    /**
     * token过期时间
     */
    public static final long EXPIRE_TIME = 7200000;

    public static final String AGENT = "agent";
    public static final String CONFIG = "config";

    /**
     * 自建应用授权用户信息缓存
     */
    public static final String SELF_APP_AUTH_ACC_CAHCE = BASE_KEY + "SelfAppAuthAcc:%s:%s";

    /**
     * 通过corp获取agentId
     */
    public static final String AUTH_CORP_INFO_CACHE = BASE_KEY + "AuthCorpInFo:%s";

    /**
     * 公众号授权用户信息缓存
     */
    public static final String MP_AUTH_ACC_CAHCE = BASE_KEY + "MpAuthAcc:%s:%s";

    /**
     * 企业微信bjwt缓存
     */
    public static final String BJWT_QYWX_IN_SESSION_VALIDITY = "bjwt:qywx:user:%s:clientType:%s";

    /**
     * 微信bjwt缓存
     */
    public static final String BJWT_WX_IN_SESSION_VALIDITY = "bjwt:wx:user:%s:clientType:%s";

}
